home *** CD-ROM | disk | FTP | other *** search
- //========================================================================================
- //
- // File: ContainerClip.cpp
- // Release Version: $ 1.0d11 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "Container.hpp"
-
- #ifndef CONTAINERCLIP_H
- #include "ContainerClip.h"
- #endif
-
- #ifndef CONTAINERPART_H
- #include "ContainerPart.h"
- #endif
-
- #ifndef BASESHP_H
- #include "BaseShp.h"
- #endif
-
- #ifndef BOUNDSHP_H
- #include "BoundShp.h"
- #endif
-
- #ifndef LINESHP_H
- #include "LineShp.h"
- #endif
-
- #ifndef OVALSHP_H
- #include "OvalShp.h"
- #endif
-
- #ifndef RECTSHP_H
- #include "RectShp.h"
- #endif
-
- #ifndef RRECTSHP_H
- #include "RRectShp.h"
- #endif
-
- #ifndef TEXTSHP_H
- #include "TextShp.h"
- #endif
-
- #ifndef CONTAINERFRM_H
- #include "ContainerFrm.h"
- #endif
-
- #ifndef CONTAINERPRXY_H
- #include "ContainerPrxy.h"
- #endif
-
- // ----- Part Includes -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment container
- #endif
-
- //========================================================================================
- // class CContainerFacetClipper
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // CContainerFacetClipper::CContainerFacetClipper
- //---------------------------------------------------------------------------------------
-
- CContainerFacetClipper::CContainerFacetClipper(Environment *ev, CContainerPart* part):
- FW_CFacetClipper(ev, part),
- fContainerPart(part)
- {
- }
-
- //---------------------------------------------------------------------------------------
- // CContainerFacetClipper::~CContainerFacetClipper
- //---------------------------------------------------------------------------------------
-
- CContainerFacetClipper::~CContainerFacetClipper()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFacetClipper::ClipEmbeddedFacets
- //----------------------------------------------------------------------------------------
-
- void CContainerFacetClipper::ClipEmbeddedFacets(Environment *ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFacet* containingFacet,
- ODShape* limitShape)
- {
- // ----- If no proxy shape we don't have anything to do -----
- if (CProxyShape::gProxyCount == 0)
- return;
-
- FW_CPoint extent;
- embeddingFrame->GetContentExtent(ev, extent);
-
- FW_CRect limitRect;
- if (limitShape)
- limitRect = FW_GetShapeBoundingBox(ev, limitShape);
- else
- limitRect.Set(FW_kZeroPoint, extent.x, extent.y);
-
- // ----- Create a temporary shape -----
- FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
-
- // ----- Create the working clip (use the content shape) -----
- FW_CAcquiredODShape aqWorkingClip = embeddingFrame->AcquireContentShape(ev); // in Frame Coordinate
-
- FW_CAcquiredODTransform aqWindowContentTransform(containingFacet->AcquireWindowFrameTransform(ev, NULL));
- aqWorkingClip->Transform(ev, aqWindowContentTransform); // now in window coordinate
-
- // ----- Go through my shapes (backward) ------
- FW_COrderedCollectionIterator ite(fContainerPart->GetShapeList());
- for (CBaseShape* shape = (CBaseShape*)ite.Last(); ite.IsNotComplete(); shape = (CBaseShape*)ite.Previous())
- {
- FW_CRect dragRect;
- shape->GetDragRect(dragRect);
- if (limitRect.IsIntersecting(dragRect))
- shape->SubtractToWindowClip(ev, this, containingFacet, aqWorkingClip, aqTempShape);
- }
- }
-